package com.sqx.modules.app.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.app.service.UserMoneyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@AllArgsConstructor
@RequestMapping("/userMoney")
@Api("app 钱包 ")
public class UserMoneyController {
    @Autowired
    private UserMoneyService userMoneyService;

    @GetMapping("/selectMyMoney")
    @ApiOperation("我的钱包余额")
    public Result selectMyMoney(Long userId) {
        return Result.success().put("data", userMoneyService.selectUserMoneyByUserId(userId));
    }

    /**
     * 余额明细
     */
    @GetMapping("/balanceDetailed")
    @ApiOperation("余额明细")
    public Result balanceDetailed(Long userId, Long page, Long limit) {
        Page<UserMoneyDetails> pages = new Page<>(page, limit);
        return Result.success().put("data", userMoneyService.balanceDetailed(userId, pages));
    }
    @ApiOperation("获取保证金明细")
    @GetMapping("/getBondDetails")
    public Result getBondDetails(Long userId, Integer page, Integer limit, UserMoneyDetails userMoneyDetails) {

        return Result.success().put("data", userMoneyService.getBondDetails(userId, page, limit, userMoneyDetails));
    }
}
